/**
 * cone-service: xssmw.js
 * Description: xss处理中间件
 * 
 * 
 * Time: 2021/11/5 13:56
 */

const xss = require("xss");

module.exports = async(ctx, next) => {
    for(let key in ctx.query){
        let newKey = xss(key)
        ctx.query[newKey] = xss(ctx.query[key]);
        if (newKey != key) {
            delete ctx.query[key]
        }

    }

    await next();
}
